package com.test.controller;

import com.test.domain.Order;
import com.test.enums.Page;
import com.test.enums.Replay;
import com.test.service.OrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * OrderController
 *
 * @author HY
 * 2021/05/24 9:09
 **/

@Api(tags = "订单管理接口")
@RestController
@RequestMapping("/admin/order")
public class OrderController {

    @Resource
    private OrderService orderService;

    @PostMapping("/insert")
    @ApiOperation("添加订单")
    public Replay insert(@RequestBody Order order){

        Replay replay = orderService.insert(order);
        return replay;
    };

    @PostMapping("/del")
    @ApiOperation("删除订单")
    public Replay del(@RequestBody int id){

        Replay replay = orderService.del(id);
        return replay;
    };

    @PostMapping("/update")
    @ApiOperation("修改订单")
    public Replay update(@RequestBody Order order){

        Replay replay = orderService.update(order);
        return replay;
    };

    @GetMapping("/select")
    @ApiOperation("查询订单")
    public Replay select(@RequestParam Order order,@RequestParam Page page){

        Replay replay = orderService.select(order, page);
        return replay;
    };

}
